<script type="text/javascript">
	

    function ajaxFilterDistrict(city_id)
    {
        $.ajax({
        url: '<?php echo $this->Html->url(array("controller" => "districts", "action" => "ajaxDistrictOption", "admin" => false));?>/'+city_id,        
        success: function( data ) {
            if (console && console.log){
              $("#ResourceinfoDistrictId").html(data);
	      //alert($("#ProductDistrictId").val());
	      //ajaxFilterProject($("#ProductDistrictId").val());
            }
          }
        });
    }
    
    function ajaxFilterCareer(city_id)
    {
        $.ajax({
        url: '<?php echo $this->Html->url(array("controller" => "careers", "action" => "ajaxCareerOption", "admin" => false));?>/'+city_id,        
        success: function( data ) {
            if (console && console.log){
              $("#ResourceinfoCareerId").html(data);
	      //alert($("#ProductDistrictId").val());
	      //ajaxFilterProject($("#ProductDistrictId").val());
            }
          }
        });
    }
    
    function filterType(type)
    {
	if(type == 1)
	{
		$("#resource_cn").css('display', 'none');
		$("#resource_o").css('display', 'block');
	}
	else
	{		
		$("#resource_cn").css('display', 'block');
		$("#resource_o").css('display', 'none');
	}
    }

</script>


<div class="resourceinfos form">
<?php echo $this->Form->create('Resourceinfo', array('type' => 'file'));?>
	<fieldset>
		<legend><?php __('Admin Add Resourceinfo'); ?></legend>
	<?php
		echo $this->Form->input('user_id');
		echo $this->Form->input('city_id', array("onchange"=>"ajaxFilterDistrict(this.value);ajaxFilterCareer(this.value);", 'label'=>'Tỉnh/Thành'));
		echo $this->Form->input('district_id');
		echo $this->Form->input('career_id');
		echo $this->Form->input('resourceinfo_type_id', array("onchange"=>"filterType(this.value)", 'label'=>'Hình thức'));
	?>
	
	<div id="resource_cn"<?php if(($this->data['Resourceinfo']['resourceinfo_type_id'] == 1) || !isset($this->data['Resourceinfo']['resourceinfo_type_id'])) echo ' style="display:none" ' ?>>
		<?php
			echo $this->Form->input('o_name');
			echo $this->Form->input('o_description');
			echo $this->Form->input('o_address');
			echo $this->Form->input('o_contact');
			echo $this->Form->input('o_contact_phone');
			echo $this->Form->input('o_phone');
			echo $this->Form->input('o_fax');
			echo $this->Form->input('o_email');
			echo $this->Form->input('o_website');
		?>
	</div>
	
	<div id="resource_o"<?php if($this->data['Resourceinfo']['resourceinfo_type_id'] != 1 && isset($this->data['Resourceinfo']['resourceinfo_type_id'])) echo ' style="display:none" ' ?>>
		<?php
			echo $this->Form->input('fullname');
			echo $this->Form->input('birthday', array(
							'dateFormat' => 'DMY',
							'minYear' => date('Y') - 70,
							'maxYear' => date('Y') - 18 ));
			echo $this->Form->input('gender');
			echo $this->Form->input('cmnd');
			echo $this->Form->input('phone');
			echo $this->Form->input('email');
			echo $this->Form->input('skills');
			echo $this->Form->input('experiences');
			echo $this->Form->input('others');
		?>
	</div>
	
	<?php
		echo $this->Form->input('create_date');
		
	?>
	
					<div class="input file">
						<label for="ResourceinfoImageFilename">Tập tin ảnh</label>
						<input type="file" id="ResourceinfoImageFilename" name="data[ResourceinfoImage][filename]">
					</div>
					<input type="hidden" id="ResourceinfoImageDir" name="data[ResourceinfoImage][dir]" />
					<input type="hidden" id="ResourceinfoImageMimetype" name="data[ResourceinfoImage][mimetype]" />
					<input type="hidden" id="ResourceinfoImageFilesize" name="data[ResourceinfoImage][filesize]" />
					
					
		
	</fieldset>
<?php echo $this->Form->end(__('Submit', true));?>
</div>
<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>

		<li><?php echo $this->Html->link(__('List Resourceinfos', true), array('action' => 'index'));?></li>
		<li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Cities', true), array('controller' => 'cities', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New City', true), array('controller' => 'cities', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Districts', true), array('controller' => 'districts', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New District', true), array('controller' => 'districts', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Careers', true), array('controller' => 'careers', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Career', true), array('controller' => 'careers', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Resourceinfo Types', true), array('controller' => 'resourceinfo_types', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Resourceinfo Type', true), array('controller' => 'resourceinfo_types', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Resourceinfo Images', true), array('controller' => 'resourceinfo_images', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Resourceinfo Image', true), array('controller' => 'resourceinfo_images', 'action' => 'add')); ?> </li>
	</ul>
</div>